package com.etc.controller.kado02;

import com.etc.common.CodeMessage;
import com.etc.common.EchartsModelVo;
import com.etc.common.ServiceException;
import com.etc.service.kado02.IKADO02Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.support.RequestContext;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;

@Controller
@ResponseBody
public class KADO02Controller {


    @Autowired
    IKADO02Service service;

    @RequestMapping("kado02.action")
    public CodeMessage kado02(@RequestParam HashMap params, HttpServletRequest request) {

        EchartsModelVo vo = null;
        try {
            vo = service.findProject(params);
        } catch (ServiceException e) {

            //　i18N wapper 処理
            RequestContext requestContext=new RequestContext(request);
            return CodeMessage.fail(requestContext.getMessage(e.getMessage()));
        }

        return CodeMessage.succes(vo);
    }
}
